package com.lancoo.rxretrofitlibrary;

import android.util.Log;

import com.orhanobut.logger.Logger;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Created by tangminglong on 17/5/15.
 */

public class LoggingInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        if (RxRetrofitApp.isDebug()){
            Logger.d("发送请求 %s on %s%n%s", request.url(), chain.connection(), request.headers());
        }
        return chain.proceed(request);
    }
}
